package com.wz.jiangsu.wangteng;

import java.util.regex.Matcher;
import java.util.regex.Pattern;  
  
public class RegexDemo {  
    public static void main(String[] args) {  
        String input = "Hello, world!";  
        String pattern = "\\w+"; // 匹配字母、数字和下划线
        Pattern p = Pattern.compile(pattern);  
        Matcher m = p.matcher(input);  
        if (m.find()) {  
            System.out.println("匹配成功！");
            System.out.println("m = " + m);
            System.out.println("\"3\" = " + "3");
        } else {  
            System.out.println("匹配失败！");
            System.out.println("m = " + m);
        }  
    }  
}